import request from '@/utils/request'

const supplierApi = {
  // 供应链详情
  getSupplyDetail: (id, deptId) => {
    return request({
      url: `/system/supply-chain/api/getSupplyChainByTenantId?id=${id}&companyType=10&deptId=${deptId}`,
      method: 'GET'
    })
  },
  // 供应链负责人
  getSupplyAdminDetail: () => {
    return request({
      url: '/system/supply-chain/api/getScmAdmin',
      method: 'GET'
    })
  },
  // 供应商列表
  getSupplierList: (params) => {
    return request({
      url: '/vms/supplier/page',
      method: 'GET',
      params
    })
  },
  // 删除供应商
  deleteSupplier: (id) => {
    return request({
      url: `/vms/supplier/delete?id=${id}`,
      method: 'DELETE',
    })
  },
  // 供应商详情
  getSupplierDetail: (id) => {
    return request({
      url: `/vms/supplier/get?id=${id}`,
      method: 'GET',
    })
  },
  // 供应商负责人
  getSupplierAdminDetail: (supplierId) => {
    return request({
      url: `/system/supplier/api/getSupplierAdmin?supplierId=${supplierId}`,
      method: 'GET'
    })
  },
  // 更新供应商认证状态
  updateSupplierStatus: (data) => {
    return request({
      url: "/vms/supplier/update-attestation-state",
      method: 'PUT',
      data: data
    })
  },
  // 校验供应商能否停用
  checkSupplierSfkty: (supplierId) => {
    return request({
      url: `/vms/supplier/checkSfkty?id=${supplierId}`,
      method: 'GET'
    })
  },
  // 更新供应商使用状态
  updateSupplierUseStatus: (data) => {
    return request({
      url: "/vms/supplier/update-use-status",
      method: 'PUT',
      data: data
    })
  },
  // 批量下架供应商商品
  delistingAllProducts: (data) => {
    return request({
      url: '/vms/supplier/delistingAllProducts',
      method: 'POST',
      data
    })
  },
  // 供应商银行信息
  getSupplierBank: (id) => {
    return request({
      url: `/vms/supplier-bank/get-by-supplier-id?supplierId=${id}`,
      method: 'GET',
    })
  },
  // 邀约供应商
  inviteSupplier: (data) => {
    return request({
      url: '/vms/supplier/invite',
      method: 'POST',
      data
    })
  },
  // 修改邀约信息
  updateInviteData: (data) => {
    return request({
      url: '/vms/supplier/updateSupplierInfo',
      method: 'PUT',
      data
    })
  },
  // 获取首页统计数据
  getHomeData: (params) => {
    return request({
      url: '/scmReport/sjtjxx',
      method: 'GET',
      params
    })
  },
  // 获取供应商统计数据
  getStatisticData: (params) => {
    return request({
      url: '/scmReport/gystjxx',
      method: 'GET',
      params
    })
  },
  // 设置默认售价规则
  setDefaultFloatRatio: (data) => {
    return request({
      url: '/vms/supplier/editFzbl',
      method: 'POST',
      data
    })
  }
}
export default supplierApi